package com.yanqu.road.entity.activity.peakseacraft;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;

import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Description 海上争霸之南海丝路 跨服 玩家竞猜数据
 */
@FieldTypeAnnotation(tableName = "t_c_activity_peak_seacraft_guess")
public class PeakSeacraftCrossUserGuessData extends DataObject {
    @FieldTypeAnnotation(desc = "活动id", select = true, update = true)
    private int activityId;
    @FieldTypeAnnotation(desc = "商会分组", select = true, update = true)
    private int unionGroup;
    @FieldTypeAnnotation(desc = "玩家id", update = true)
    private long userId;
    @FieldTypeAnnotation(desc = "服务器ID")
    private long serverId;
    @FieldTypeAnnotation(desc = "竞猜的商会列表 k:轮次 v:商会id列表")
    private Map<Integer, PeakSeacraftGuessInfo> guessMap = new ConcurrentHashMap<>();

    public PeakSeacraftCrossUserGuessData() {
    }

    public PeakSeacraftCrossUserGuessData(int activityId, int unionGroup, long userId) {
        this.activityId = activityId;
        this.unionGroup = unionGroup;
        this.userId = userId;
        setInsertOption();
    }

    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

    public long getUserId() {
        return userId;
    }

    public long getServerId() {
        return serverId;
    }

    public void setServerId(long serverId) {
        if (this.serverId != serverId) {
            this.serverId = serverId;
            setOp(DataStatus.Update);
        }
    }

    public void setUserId(long userId) {
        if (this.userId != userId) {
            this.userId = userId;
            setOp(DataStatus.Update);
        }
    }

    public Map<Integer, PeakSeacraftGuessInfo> getGuessMap() {
        return guessMap;
    }

    public void setGuessMap(ConcurrentHashMap<Integer, PeakSeacraftGuessInfo> guessMap) {
        this.guessMap = guessMap;
    }

    public void updateGuessMap(int round, PeakSeacraftGuessInfo guessInfo) {
        if (round <= 0 || guessInfo == null) {
            return;
        }
        this.guessMap.put(round, guessInfo);
        setUpdateOption();
    }

    public int getUnionGroup() {
        return unionGroup;
    }

    public void setUnionGroup(int unionGroup) {
        this.unionGroup = unionGroup;
    }
}
